"""
Simulated gimbal calibration module with progress tracking
"""
import time

# 全局进度状态
_calibration_progress = 0

def calibrate_gimbal(device_id, calibration_types=None, progress_callback=None):
    """Simulate gimbal calibration for a device with progress tracking."""
    global _calibration_progress
    
    print(f"Start gimbal calibration - Device ID: {device_id}")
    
    # 重置进度状态
    _calibration_progress = 0
    
    return {
        "status": "started",
        "message": f"Calibration started for device {device_id}",
        "device_id": device_id,
        "calibration_types": calibration_types or []
    }

def get_calibration_status():
    """Return current calibration progress and auto-increment."""
    global _calibration_progress
    
    # 如果进度小于100，自动增加进度
    if _calibration_progress < 100:
        # 每次增加5%，模拟3.5秒完成
        _calibration_progress = min(_calibration_progress + 5, 100)
    
    return int(_calibration_progress)
